The Dimension 5150 Specifications list compatible CPU's as:
Intel Pentium 4 5XXX and 6XXX processors with Hyper-Threading technology
A Core 2 Duo is not a Pentium 4 processor and as you have found out won't work on the Dimension 5150 motherboard.
The E520 and 5150 both use BTX size motherboards. BTX (for Balanced Technology eXtended) is a form factor for motherboards, originally intended to be the replacement for the aging ATX motherboard form factor in late 2004 and early 2005. However, future development of BTX retail products by Intel was canceled in September 2006.
Whether your Windows operating system license will still be valid is one possible problem you might have. I would not put any money into such a dated system.