There should be a visible arrow on a fuel filter, which shows direction of fuel flow (i.e., from gas tank towards the engine). If you don't have a label, but had a plastic cap on one end of new fuel filter, the end with plastic cap goes towards the engine. Check this website for fuel filter replacement instructions (if you need any):
http://www.pelicanparts.com/bmw/techarticl...Fuel-Filter.htm
P.S.: If you took yours out and want to put it back, consider buying a new one instead ($20 part from the dealer or OEM on Ebay) - it is best replaced annually anyway. I suggest not to buy this from AutoZone and such.