You can walk to either park from any of the resorts:
To Epcot: about 10 to 12 minutes from BC or BW, 14 to 16 from YC, 16 to 20 from S/D.
To MGM: about 22 to 25 minutes from BW or S/D, 28 to 32 from YC/BC.
You can also go by boat. The boat loop is MGM to S/D to YC/BC to BW to Epcot to BW to YC/BC to S/D to MGM. Thus to and from Epcot BW is closest by boat because there is no stop in between; to and from MGM S/D is closest for the same reason. Boat can take longer than walking to Epcot; boat is faster to MGM if you use S/D dock and longer if you use BW dock.