You are a
Dentist
I am so optimistic, as happy as can be
Dentist are usually happy people, and they like smiles.
But deep inside darkness, violence you may see.
It is dark in your mouth, which is where the dentist's work is done. Depending on the status of your oral hygiene, the dentist's work might be violent, with bleeding gums and worse commonplace (not that I know from experience...).
To half the population, danger is my name,
For after an encounter, they never are the same.
A surprising number of people are afraid of going to the dentist, due to the pain that they expect and sometimes receive on visiting. A dentist may leave someone "never the same" by pulling teeth, whether molars or otherwise, drilling, putting in caps, or just scaring the patient even more severely.
For others I'm just there, don't really do too much,
I tend to vanish quickly, without a single touch.
Those with good oral hygiene may actually see the dentist for no more than a minute. The dental hygienist does most of the cleaning and inspection, which the true dentist just pops in to double-check.
But all I trap inside of me, as I contemplate,
And soon they're free to go, without that which I hate.
I think this just refers to all that go to the dentist, not ALL IN EXISTENCE, so: Everyone that goes to the dentist has their teeth cleaned of plaque and gingivitis, which is what the dentist hates the most.
Determine now who I am, and what it is I do,
Who fears me, who doesn't care? Am I one or two?
You are the dentist and hygienist, and you both clean teeth, but one more than the other. Those with good teeth don't care, those with bad teeth do. You are two who say "Let's put a smile on that face of yours!"
I'll also say that:
An orthodontist changes people, too, and could be said to hate crooked teeth, but people leave the orthodontist with braces, not straight teeth, and they leave the dentist with clean teeth. With that, I think dentist better fits the bill.