Generally, a direct kick, in soccer, comes from a specific contact foul or hand ball. Anything else is indirect kick.
A penalty kick becomes a contact foul or hand ball after being touched (with hands or arms) by the defending team standing in the penalty area. A handball can be intentional (sometimes) unintentional (mostly).