Sound waves travel through compression and rarefaction, thus they need a medium to travel. Sound waves cannot travel in absence of medium such as vacuum.
Thus, the Doppler formula for frequency shift differs in the cases of movement of observer while source is at rest and movement of source while observer is at rest. In addition, the sound waves cannot travel in vacuum.
Light is electromagnetic wave and it can propagate without any medium. In case of vacuum, the Doppler formula for the two given cases would be identical as light waves do not depend on the motion of observer or source. While, in case of light travelling in a medium, the speed of light depends on the wavelength. Thus, the Doppler formula will not be identical for the two cases.