Yes you can do this without needing to think in terms of angles at all.
Since you have a cube, suppose you pick one corner and then define the 3 edges radiating out from it as vectors f0, f1, f2 (these are direction vectors, relative to the corner you've picked). Normalise those and write them as columns in a matrix F
(f0x f1x f2x)
(f0y f1y f2y)
(f0z f1z f2z)
Now do the same thing for the vectors t0, t1, t2 of the cube you want to rotate to and call it matrix T.
Now the matrix R = T * Inverse(F) is the matrix which rotates from the orientation of the first cube to the orientation of the second (because inverse F maps e.g f0 to (1 0 0)', and then T maps (1 0 0)' to t0).
If you want to know why this works, think in terms of coordinate system basis vectors: if you want to rotate the X Y and Z axes to a new coordinate system, well the columns of the rotation matrix are just the vectors you want (1 0 0)', (0 1 0)' & (0 0 1)' to be mapped to. T*Inverse(F) is effectively rotating your cube from its original orientation to axis aligned, and then to the desired orientation.
(Sorry, above is for column vectors and transforms on the left, OpenGL style. I seem to remember Direct3D is row vectors and transforms on the right, but it should be obvious how to switch it around).
It also applies equally well to 4x4 matrices with a translation component too.