To add to UCrewX5s comments. Yes, but the configuration of your stereo system needs to be the same.
The two front Connections are the same (white and Blue 18 pin), the two navigation computer connections are the same Blue / Magenta although sometimes JUST Blue, the magenta comes off it's own short harness, the Radio connection is the same if new gen radio (or old round pin radio) ... BUT the amp connections are different based on what type of amp you have.
In addition, most people remove the speaker wires and leave the same speaker wires that are already in the dar. With DSP this is easy.
check out this page where an X5 harness was used in an E38
http://bimmernav.com/95_retrofit.htm
Martin