Generally speaking, they're both versions of a language that are similar. However, unless someone has a "strong accent," two speakers of one language with different accents can still understand each other.
Also, an accent is not necessarily associated with a region or group of speakers. Someone who learns a second language may "speak with an accent" in that language. Someone with a lisp may also be described as "having an accent."
A dialect, on the other hand, generally means more than one speaker, and it also is distinct enough from another language that it can't be fully understood by a similar language. This idea in linguistics is called "not mutually intelligible."
Some real-life examples would be English and Arabic. English is said to have many accents (british, american, indian etc), whose vocabulary and usage is almost identical. Arabic, on the other hand, has certain grammatical features that vary from country to country where it is spoken, and so in some cases a speaker from, say, Egypt might use different negation from someone from the UAE.