Do both bikes run Shimano or compatible components?
The derailleur cage length is not important.
The cassette needs to have the same number of cogs as the shifter is made to shift.
The chain may not be long enough, in which case you need to replace it. Check the chain wear, if its worn its not worth changing over. Otherwise it should work fine.
If the road bike has 9 or 10 speed rear, the chain must be specific to 9 or 10 speed, not an issue if you swap both chain and cassette.