Here's the REAL secret. It's not enough just to know the names of the notes and the keys...you must also be able to read by intervals. Some people who play by ear may do this already, by recognizing chords and patterns from others' performances. If you want to skip the long explanation, go to the last paragraph.
All melody and harmony is made up of intervals. That is the distance between low and high note pitches. On a guitar, that's a half-step from fret to fret. On the keyboard, a half-step is from one piano key to the very next one (black or white). Two half-steps equals a whole step (interval of a major second).
Now the difference between Guitar/Bass and Piano is that Western Notation is set up to reflect the white (letter A B C D E F G ) keys on the keyboard. It is supposed to be a keyboard TAB, but it goes up and down instead of from left to right. And the black keys in between were added later as an afterthought, being relegated to sharps and flats. If you keep in mind that the white keys represent the lines and spaces of the staff, you can find the distance between keys by counting them.
Bottom line - learn to recognize the patterns in notation. Line to the next space (or space/line) is two white keys, a 2nd (like a number line - always count the first key - think 'first grade, 2nd grade). Line to the next line or space to next space is always a 3rd, the distance of 3 white keys. When it comes to naturals, other intervals in melodies or chords can be counted up or down using the white keys. Since black keys are sharps/flats, they are shown in notation as alterations of the white keys, like Bb or F#. Find the white letter key, then go up or down a half-step to play them...