BUG: DTI.freqstr raises AttributeError when freq is None

``DatetimeIndex.freqstr`` raises ``AttributeError`` if ``freq/offset`` is ``None``, even though docstring says "return the frequency object as a string if its set, otherwise None"
```
idx = pd.DatetimeIndex(['2011-01-01', '2011-01-02', '2011-01-03', '2011-01-04'])
idx.freqstr
# AttributeError: 'NoneType' object has no attribute 'freqstr'
```
Also,  ``DataFrame/Series.to_period`` has a logic to use ``inferred_freq`` when the freq is not passed, but it doesn't work actually because of the bug. Moved the logic to ``DatetimeIndex.to_period`` for consistency and made it works.

The fix will simplify #7602 a little.