Note that there are rules for transcribing Latin (Romaji) into Japanese, see here: https://en.wikipedia.org/wiki/Transcription_into_Japanese.
Hiragana is basically used for Japanese words (for instance for suffixes or if you do not know the correct Kanji symbol), whereas Katakana is used for foreign words, foreign names and in publicity, in order to highlight things.
We could say that the pronunciation of the latin transcription is like in English for the consonants (for instance "Y" for a German "J") and like in Spanish or Italian for the vowels. When writing non-Japanese names make sure that the transcription corrensponds to the pronunciation in your mother-tongue. For instance: Manfred in German turns into Manfuredo (マンフレド), whereas in English you might prefer Menfureddo (メンフレっド). There is no binding rule how to transcribe foreign names, but the way you transcribe a name gives a Japanese a hint how to pronounce it - at least more or less.
There are rules how to transcribe double consonants, the "n" at the end also exists in Japanese, but that's it. The "d" at the end of the syllable is a problem. We just can use something similar, like "do" (ド). An "s" for instance is mostly transcribed as "su", for instance "Tomasu" (トマス) for "Thomas". The "l" does not exist in Japanese. It is normally transcribed with an "r". The female name "Lara" would turn into "Rara" (ララ), which would by the way sound rather strange in Spanish for instance (raro = strange, being "rara" the female form). We can only try to approach the correct pronunciation as much as possible. That's what makes it difficult to Japanese to speak languages which have consonants that are not directly connected to vowels or which have consonants at the end of the syllables. And that's also the reason why it is no major problem for a Japanese to pronounce correctly languages like Spanish or Italian (apart from the "l" or the Spanish "j"). Well, this problem actually applies to any language with a reduced number of sounds.
If you need a hint which combinations of consonants and vowels are possible consult this list: https://en.wikipedia.org/wiki/Katakana.
Try it yourself!