I have an armature ArmatureA which has an animation, and I have another armature ArmatureB which has a mesh parented to it. I want to map ArmatureB to have the same location and bone rotations as ArmatureA. I've tried doing it using bone constraints but I can't figure out the correct parameters and constraints to use so that ArmatureB is doing the same action as ArmatureA and in the same location.
Check that the bone rolls and root bones roughly correspond, otherwise it may be quite difficult. If the bone rolls don't match, consider experimenting with using a combination of damped track (will ignore twist, so effectively copy rotation for just x and z) and copy rotation (just for y, in local space).
In the images posted you seem to not have constraints on many of the bones which may be causing issues due to mismatched rotations inherited from parents.
I would suggest start from the root bone of mesh's armature and get that to match the movements of the animated armature. Then slowly work your way down the bone hierarchy.
The process of transferring animation data from one rig to another, which looks like what you are trying to do is generally called retargetting, and searching for that may yield helpful results.