How do you play an E? How are those two chords related? I don’t know the answer to any of those questions. There is a major-minor-chord chart that is on the guitar, and it’s pretty much the only answer you’ve got when you’re going from a D to a F chord. It’s also the easiest answer to get if you don’t know a C major chord. A C major 7th chord, such as 3rd C in the C major scale, doesn’t have a 4th or 5th (i.e., a Bm7 or Cmaj7); instead, it has a major third, a minor third, an augmented third and so on. (If the fourth is too hard, you use a D minor chord instead.) Therefore, the closest you’ll get to a 4th chord is from an augmented major 7th chord which would be Gmaj7.
Another way to look at an F chord is as one of two C chord shapes (a C and a C#):
To figure out which C# you’ll play, start in a major key if you’re starting with an E, and if you’re starting in a minor key if you’re starting with a D, and work out each chord in the root key (to find the root note, start in the root note, then move all the way up until you reach that note). From then on, the major C# chord will be Gmaj7.
C-E-G D#-A C#-4 A -5 C#-4 A C#-4 A C#-3 C5 D#-3 C#-5
For an E and a D chord, you have a C-D-E#-G chord:
E-E-D D#-A E-E-D D#-A E-E-D D#-A E-E-E#-E E-E-A-E#-E#
Once you’ve determined which C# you’ll play, play each chord in the root key, working up from C to the 5th and then G down to the root C, as described above. When you’re ready to move up the scale, you could also try the same move up to A by moving up 7 frets to the root D. So for an E#maj7 chord, you’d play E-E-G-