The cable will work fine.
However the iPhone charger is underpowered for the iPad. It will charge at less than half the rate of the iPad's charger. On the other hand the iPad's charger will work fine with the iPhone, so if you are looking at only carrying one charger, that's the one.