Generalized ConstantMat to ConstantData