Do the bikes use the same brand of drivetrain, with the same number of speeds in back? For example, are both bikes 11 speed, Shimano systems? If so, swapping the cassette is easy. You just need the appropriate lockring tool and a crescent wrench.
And obviously, this question belongs in the bike mechanics subforum. Not in general cycling.