MTB Helmet on a Road-Touring Cube bike
The helmet itself will work fine.

On a road bike like the one you posted a photo of, your head and shoulders are usually a lot lower than on a mountain bike.  The visor on the helmet may block your forward vision because of that.  Or you may wind up having to force yourself to hold your head higher than is natural, which might be very tiring on your neck.  If so, just take the visor off.  It looks to have bolts/screws holding it on, so it's probably designed to be removed.

One comment:  that helmet doesn't appear to be very well ventilated.  If you do long rides when it's hot, that may be bothersome.  Then again, if you commute year-round, that may be very useful when it's cold.