### Godot version

4.0.2.stable.official.7a0977ce2

### System information

Linux

### Issue description

The following code fails with godot-cpp
```c++
Variant variant_int = 1234;
double double_value = variant_int;
UtilityFunctions::print(double_value); // prints 0. it must be 1234

Variant double_variant = 6789.0;
int int_value = double_variant;
UtilityFunctions::print(int_value); // prints 0. it must be 1234

Variant variant_string = "12345";
StringName string_name = variant_string;
UtilityFunctions::print(string_name); // Segmentation Fault!
```

When godot-cpp converts a `Variant` to another type, it calls `type_from_variant_constructor` without checking its type. It only does  `reinterpret_cast` and does no type conversion.
I think this issue can be solved by implementing type conversion on the godot-cpp side or by making `type_from_variant_constructor` do the type conversion.

### Steps to reproduce

Unzip the minimal reproduction project and run `scons` to build the GDExtension.

### Minimal reproduction project

[variant-conversion-issue.zip](https://github.com/godotengine/godot/files/11171860/variant-conversion-issue.zip)

v->_data.packed_array = Variant::PackedArrayRef<Vector2>::create(Vector<Vector2>());
		v->type = Variant::PACKED_VECTOR2_ARRAY;
	}
	_FORCE_INLINE_ static void init_vector3_array(Variant *v) {
		v->_data.packed_array = Variant::PackedArrayRef<Vector3>::create(Vector<Vector3>());
		v->type = Variant::PACKED_VECTOR3_ARRAY;
	}
	_FORCE_INLINE_ static void init_color_array(Variant *v) {
		v->_data.packed_array = Variant::PackedArrayRef<Color>::create(Vector<Color>());
		v->type = Variant::PACKED_COLOR_ARRAY;
	}
	_FORCE_INLINE_ static void init_object(Variant *v) {
		object_assign_null(v);
		v->type = Variant::OBJECT;
	}
	_FORCE_INLINE_ static void clear(Variant *v) {
		v->clear();
	}
	static void object_assign(Variant *v, const Object *o); 
	static void refcounted_object_assign(Variant *v, const RefCounted *rc);
	_FORCE_INLINE_ static void object_assign(Variant *v, const Variant *o) {
		object_assign(v, o->_get_obj().obj);
	}
	_FORCE_INLINE_ static void object_assign_null(Variant *v) {
		v->_get_obj().obj = nullptr;
		v->_get_obj().id = ObjectID();
	}
	static void update_object_id(Variant *v) {