### 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)

case Variant::PACKED_INT32_ARRAY:
				return get_int32_array(v);
			case Variant::PACKED_INT64_ARRAY:
				return get_int64_array(v);
			case Variant::PACKED_FLOAT32_ARRAY:
				return get_float32_array(v);
			case Variant::PACKED_FLOAT64_ARRAY:
				return get_float64_array(v);
			case Variant::PACKED_STRING_ARRAY:
				return get_string_array(v);
			case Variant::PACKED_VECTOR2_ARRAY:
				return get_vector2_array(v);
			case Variant::PACKED_VECTOR3_ARRAY:
				return get_vector3_array(v);
			case Variant::PACKED_COLOR_ARRAY:
				return get_color_array(v);
			case Variant::OBJECT:
				return get_object(v);
			case Variant::VARIANT_MAX:
				ERR_FAIL_V(nullptr);
		}
		ERR_FAIL_V(nullptr);
	}
};
template <class T>
struct VariantGetInternalPtr {
};
template <>
struct VariantGetInternalPtr<bool> {
	static bool *get_ptr(Variant *v) { return VariantInternal::get_bool(v); }