They can both be used in a similar way to challenge somebody, specifically somebody you think is being nosy or interfering. You could say it because they're acting like they know things but you don't believe they know something ("You shouldn't press that button." "How would/do you know? You don't know anything about computers.") You might also say it because they shouldn't know something because it's none of their business. In this context, "How would you know?" is maybe slightly ruder, when it's less likely someone knows, but they are close in meaning.
However, "How do you know?" can be used in other contexts, not to dismiss someone but to get an answer, e.g. "He's on vacation." "How do you know?" "I asked his neighbor." "OK, thanks." It depends on the tone of voice whether an answer is expected, or whether it's used to mean "Go away and leave me alone."
"How do you know that?" is a simple question format. "Would" can be used to indicate doubt or possibility, so "How would you do that?" means "Is there any way you can know know that?" or "How can you possibly know that?"