How to get a custom entry field label with Gravity Forms?

I’m not sure there is much that can be done to truly simplify this… you certainly have the right idea on what needs to be done. Here’s one take you might consider that simplifies it a bit by removing not prefetching the labels. This simpler version is negligibly less performant.

$form_id = '1';
$form    = GFAPI::get_form( $form_id );
$entries = GFAPI::get_entries( $form_id );

$data = [];

foreach ( $entries as $index => $entry ) {
    foreach ( $entry as $key => $value ) {
        $field = GFAPI::get_field( $form, $key );
        $label = $field ? $field->get_field_label( false, '' ) : $key;
        $data[ $i ][ $label ] = $value;
    }
    $i++;
}

echo '<script>const data=" . json_encode( $data ) . "</script>';