This is what you would call a "Figure of Speech", keyword there being 'Figure'.
If you were to say "If you dream 'of' it, you can do it" that would mean, literally, you dreamed of it.
But being a 'Figure' of speech, you would say "If you dream it, you can do it."