How to be mature?

When I am in family, everyone thinks I am mature enough. But when I am with the people who I like genuinely, I tend to behave really immature.
It just happens.
I want to be more mature, in every group
How to be mature?
Post Opinion