You can convert between matrix types using conv_to:
mat A = my_function();
fmat B = conv_to<fmat>::from(A);
fmat C = conv_to<fmat>::from(my_function());
Alternatively, you could change your function into a template; for example:
template <typename T>
Mat<T> other_function() {
return Mat<T>(4,4);
}
...
fmat D = other_function<float>();
mat F = other_function<double>();