When the one who had a legion of demons possessing him was healed by Jesus, they begged Jesus to leave their area. Jesus told him to go and tell them what He had done for him as a witness to the power of God, imo. This was Jesus' way of showing that group of people the miracle He did, and that God, the Son, was here at that time.
The Bible can be such a fun book, how blessed we are to be able to do these things.
Can you imagine what a total pain and heartache this guy was to his family while he was possessed? And what a healing it was also to the family to have him restored back to them in a normal state of mind?
He was a Gentile, and he wanted to join with and follow Christ, evidently to be a disciple; Jesus told him to go home and declare the great things God had done.
The 12 y/o maiden was in amongst a bunch of believers and non-believers. The non-believers sought many ways to cause Him to "stagger" so that they could kill Him, seeing that they wouldn't believe. Personally, I believe He told her to keep her silence so that He wouldn't be bombarded with stones. His hour of death wasn't yet, and He knew this, but this was His way of seeing that the "fulfillment hour" would happen at precisely the right time, imo.
The man healed of demon possession was a Gentile in Gentile territory. The girl was Jewish and in Jewish territory. The resurrection of the girl would cause greater scrutiny in Israel and raise opposition to His ministry before the appointed time, IMHO.
edited to add.... convicted1 has already said much the same thing.
peace to you

raying:
Edersheim cites the open hostility from the Jewish authorities that His fame from the miracles would cause as one of the reasons for His injunction of silence. Also, it was His character to shrink from the fame connected with miracles and, as a matter of necessity as to not attract 'sight seers', 'aspirants for temporal benefits', curiosity seekers, etc.
It seems the more He charged them to keep quiet the more they told:
43 And he strictly charged him, and straightway sent him out,
44 and saith unto him,
See thou say nothing to any man: but go show thyself to the priest, and offer for thy cleansing the things which Moses commanded, for a testimony unto them.
45
But he went out, and began to publish it much, and to spread abroad the matter, insomuch that
Jesus could no more openly enter into a city, but was without in desert places: and they came to him from every quarter. Mk 1