I believe something like this should work:
random_position_world = (Quat_A * random_position_A) + xA_world
random_position_B = inverse(Quat_B) * (random_position_world - xB_world)
random_rotation_world = Quat_A * random_rotation_A
random_rotation_B = inverse(Quat_B) * random_worldrandom_rotation_world
The suffix _world here is to denote that the value is expressed in world space. If you want a bit more insight into this sort of thing you should read about transformation matrices.