I am aware of how in theory these two are different, that the triplet are three notes with same length and the dotted-quaver/dotted-quaver/quaver have the third notes slightly shorter in tempo. But I want to know in terms of sound and composing, what would led you choose one over the other?
The following are the exact same rhythms you posted, but each one is divided into smaller values and they are placed on top of each other to make the comparison easier.
As you can easily see, the two notes you said don't fall at the same beat. They are slightly off.
This is because in the case of the triplets, you divide the beat by 3 (and play the first and third note), whereas in the case of the dotted eighth, you divide the beat by 4 (and play the first and fourth note). The difference isn't that big, and an amateur player might not be able to hear/play it, but it is there and it is important.
Now as far as which one to choose, it would be totally up to the composer. If played correctly, they have a different feeling and the choice depends on what the composer wants to do. For me, the triplets have a more laid back feeling and the dotted eighth has a more sharp feeling. It would also depend on how the rest of the piece (or part of the piece) goes. It's quite common to have a part of the piece that has triplets all the time, so the composer would add the dotted eighth to create a small difference in this specific passage, or vice versa, when a piece has a lot of sixteenth notes, adding quarter triplets might feel like the piece is "slowing down". I, personally, love this "slowing down" effect and use quite often.
Beyond the obvious - the two rhythms are different - it helps to have some context on the history and use of the second rhythm.
The second rhythm is often known as the tresillo and is historically popular in Latin American (particularly Cuban) music. It is however African in origin, having been bought to the Americas by slaves.
More recently the tresillo has been used extensively in reggaeton, from which it has spread further into Western pop music. The most famous/successful recent example of it's use is in Despacito by Daddy Yankee and Luis Fonsi.
There's a nice video discussing it (with many more examples) here:
I don't know why we're getting such complicated answers/comments to this simple question. The triplet is a smooth rhythm with three equal notes. The other is a more jerky, syncopated rhythm. They're not just different 'in theory'. They're similar but different, period. Like apples and oranges are both round fruits, but they're DIFFERENT round fruits. Write the one you want to hear.
(As mentioned in other answers) the triplet sounds like a smooth 3-beat bar; because it's written as a triplet (rather than as a 3/4 measure with a slightly slower tempo), this structure is useful as a contrast to a piece written in 4/4 with a 4-beat bar (or 2-2 with a 2-beat bar.)
The other measure sounds more like a 3+3+2 additive measure than a division of 4 or 8 beats into 2 or 4 (or 3 in the question). This structure is often set against a 4-beat measure in an interlocking manner (but different from a 4 against 3 sound.) This structure is extremely common in tango music and is used in cha-cha-chas and rumbas also (and in American style bolero music.) Division of 8 beats (or half-beats) into 3+3+2 against a 4/4 background works well even over long time spans (like a minute or so.) The combination of 4/4 (four quarter notes) vs 3+3+2 (two dotted quarters +quarter) can be set nicely against a clave rhythm (either son or rumba clave). The interlocking accents add just enough syncopation to keep rhythmic interest for several minutes. Of course, different instruments can trade off playing a given rhythm.
The difference is: they are not the same at all, like you say in the triplets the length values are equal while the dotted example the 2 first notes are longer than the third!
When apply the different notations?
In my ear I hear two different stiles:
The triplets I’d use to indicate for a legato or tenuto interpretation, extending to rubato in a slower section.
the dotted version is applied in a faster, rhythmic, accentuated and rather staccato passage (especially the last beat which is somewhat shorter than the 2 precedent.
(e.g. 1 = Jazz, 2 = Rock)
There are other pieces like a March or a Scherzo where the triplets are also staccato - and not smooth.