Silence/dismiss all non-contact calls
There is no way for you to do this.
You cannot block all numbers besides contacts, only selected ones.

However you can essentially do the same thing.
Go to Settings > Do not disturb

When you are there you should enable it manually, unless you want to schedule these settings. 

Then "Allow Calls From" set to "All Contacts" under "GROUPS".

Even though it won't block them it can do something very similar to what you want.

If you want to do this with messages:

You can filter iMessages but not phone calls.
You can filter iMessages from people who aren't saved in your Contacts.
To filter iMessages, go to Settings > Messages and turn on Filter Unknown Senders.
In Messages, you'll see a new tab for Unknown Senders but you won't get notifications for these iMessages.