Armature posing. How to convert object space to pose space?

I currently read two separate armatures from file via Python. I’ve attached screenshots for both. The first one shows the armature in a neutral pose, whereas the second one is my desired pose. The armature is hierarchical, i.e. each bones is connected to its respective parent.

Ultimately, I don’t want to have two separate armatures, but rather pose the neutral one correctly using PoseBones. So far all my approaches resulted in many garbled armatures. I tried using the object’s convert_space method, but it does not seem to convert the matrix to something I could assign to PoseBone::matrix or PoseBone::matrix_basis.

Does anyone know how to properly convert the matrices into the pose matrices?