楼的东边could have two different definitions in different context.
It either means 'the eastern part of the building' or '(to) the eastern side of the building'.
东边的楼 is much easier to explain. 东边的 or XX的 is always used as an adj. , so here it simply means "the building on the east" or "the eastern building".