Wordpress - Populate Taxonomy from Custom Posts

I always use something like:

add_action('save_post', 'mdz_correlate_casos_taxonomy');
function mdz_correlate_casos_taxonomy( $post_id ){

    if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ) 
        return $post_id;

    if ( 'YOUR CUSTOM POST TYPE' == $_POST['post_type'] ){
        if (!wp_is_post_revision($post_id)){
            if (!term_exists( $_POST["post_title"], 'YOUR CUSTOM TAXONOMY' )){

                $termid = wp_insert_term( $_POST["post_title"], 'YOUR CUSTOM TAXONOMY' );

            }
        }
    }

}

But this is prone to get inconsistent (ie: if you delete a post, the term won't get deleted)