I am not sure why exactly you are asking. Maybe you can clear the motivation for your question a bit. Are you having troubles with either matrices or quaternions or how they can be converted into each other?

Matrices give you a single way for representing and dealing with any transformations, and they are, unlike quaternions, natively supported by OpenGL and GLSL and the whole rendering pipeline.

Additionally, matrices have the nice property that you can concatenate many matrices representing various transformations (translation, scaling, rotation, shearing, projection) together to save matrix multiplications in the end.

Of course you can also concatenate quaternions, but you would then need to have two different computation paths in your shader, one for quaternions for computing rotations, and one for matrices for anything else. That would be quite cumbersome. And in case you are using the fixed-function pipeline, then matrices really are your *only* option to transport transformations to the rendering pipeline.

So, it is perfectly reasonable to convert a quaternion to a matrix, in order for OpenGL and GLSL to handle them in the standard way.